package com.twt.survey.utils;

import java.util.List;

public class StaticUtils {
    // 判断 "其他___" 选项
    public static String judgeOther = "other.";
    public static Integer judgeLen = 6;
    public static Integer judgeStart = 0;
    public static Integer judgeEnd = 6;

    public static String[] setValue(List<String> list){
        String target = "", targetOther = "";
        if (!(list == null || list.isEmpty())){
            for (String s : list){
                if (s.length() >= StaticUtils.judgeLen){
                    if (StaticUtils.judgeOther.equals(s.substring(StaticUtils.judgeStart, StaticUtils.judgeEnd))){
                        targetOther = "1";
                        break;
                    }
                }
            }
            target = list.toString();
        } else {
            targetOther = null;
        }

        String[] res = new String[2];
        res[0] = target;
        res[1] = targetOther;
        return res;
    }
}
